
# The following MUST be at the top of every Makefile.
TOPDIR ?= ..
include $(TOPDIR)/tools/Makefile.pre

# Modify MODULES to be the list of all modules which must be done
# first before this one (comment out if none).
# Be sure to refer to modules by their regular absolute path name,
# e.g. $(TOPDIR)/foo
MODULES += 	                \
    $(TOPDIR)/debuglog		\
    $(TOPDIR)/poller        \
    $(TOPDIR)/mainthread    \
    $(TOPDIR)/fdb	        \
    $(TOPDIR)/hw            \
    $(TOPDIR)/unicode       \
    $(TOPDIR)/hwReg     	\
    $(TOPDIR)/uart		    \
    $(TOPDIR)/reboot		\
    $(TOPDIR)/pwin

# The following will do make in all subdirectories with a Makefile first.
# 	Comment this out if you do not want or need this.
$(foreach modmakefile,$(wildcard $(MODDIR)/*/Makefile),$(eval MODULES += $(patsubst %/,%,$(dir $(modmakefile)))))

# Modify LIBNAMES to be list of all names of libraries to create
# (comment out if none).
# The names of libraries do NOT include .a extension in this case.
# All libraries created are automatically exported.
LIBNAMES :=  display

# For each library name, provide LIB_SRC_<name> giving source files
# The names of libraries do NOT include .a extension in this case.
LIBRARY_SRC_display :=      \
	    dispFont.c          \
	    dispMH133Drv.c      \
	    zcom_DrawBitmap.c

# For each library name, provide LIB_LIBS_<name> giving other library files
# that should be linked into a program to support this library.
# The names of libraries do NOT include .a extension in this case.
LIBRARY_LIBS_display := \
    debuglog	\
    uartPoll	\
    mainthread	\
    fdb		    \
    poller	    \
    pwin	    \
    reboot	\
    hw


# List all header files to be exported (installed in other modules)
# (comment out if none).
EXPORT_HEADERS += display.h

# Modify PROGRAMS to be list of all names of programs to create
# (comment out if none).
# All programs created are automatically exported.
#could-be# PROGRAMS := 	\
#could-be#     displayTest

# For each program name, provide PROGRAM_SRC_<name> giving source files
# and provide PROGRAM_LIBS_<name> giving library names (no -l or .a !).
#could-be# PROGRAM_SRC_displayTest := \
#could-be#     displayTest.c

# For each program name, provide PROGRAM_LIBS_<name> giving
# library files required by name and with NO .a extension.
#could-be# PROGRAM_LIBS_displayTest := \
#could-be#    display


# prevent problems with delayed evaluation:
$(eval DISPLAY_MODDIR := $(MODDIR))
$(eval DISPLAY_OUTDIR := $(DISPLAY_MODDIR)/$(OUTDIRNAME))


# Extra rules for building fonts
#
FONTS   :=  b12.bdf           
#            b12.bdf        \
#            X11_5x8.bdf         \
#            X11_6x10.bdf        \
#            X11_9x15bold.bdf    \
#            X11_5x8b.bdf         \
#            X11_6x10b.bdf        \
#            X11_9x15bbold.bdf    \

PW_FONTS = $(FONTS:%.bdf=$(DISPLAY_OUTDIR)/include/%.pwf)

#
# Add rules for each font.o object depending upon the pwf font files.
#
#  .o/obj/TARGET/font.o: $(PW_FONTS)
#
$(foreach target, $(TARGETS), $(eval $(call MakeDep,$(DISPLAY_OUTDIR)/$(target)/obj/dispFont.o,$(PW_FONTS))))

$(DISPLAY_OUTDIR)/include/%.pwf: $(DISPLAY_MODDIR)/%.bdf $(DISPLAY_MODDIR)/bdf2pwf
#	$(DISPLAY_MODDIR)/bdf2pwf $< 0-255 19968-40664 > $@
	$(DISPLAY_MODDIR)/bdf2pwf $< 0-255 8355-8364 `cat $(DISPLAY_MODDIR)/cn-full.txt`> $@

# The following MUST be at the end of every Makefile
include $(TOPDIR)/tools/Makefile.post
